<!-- 基础模板 -->
<!DOCTYPE html>
<html lang="en">
<head>
    {% block head %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ user.name }}'s Watchlist</title>
    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css">
    {% endblock %}
</head>
<body>
     <!-- 插入到页面标题上方 -->
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
                <div class="message message-{{ category }}">{{ message }}</div>
            {% endfor %}
        {% endif %}
    {% endwith %}
    <h2>
        {{ user.name }}'s Watchlist
    </h2>
    <nav>
        <ul>
            <li><a href="{{ url_for('index') }}">Home</a></li>
            <!-- 模板内容保护 -->
            {% if current_user.is_authenticated %}
                <li style="float: right;"><a href="{{ url_for('logout') }}" >Logout</a></li>
            {% else %}
                <li style="float: right;"><a href="{{ url_for('login') }}" >Login</a></li>
            {% endif %}
        </ul>
    </nav>

    {% block content %}{% endblock %}
    
    <footer>
        <img class="totoro" src="{{ url_for('static', filename='images/icon-footer-bx.png') }}">
        <small>&copy; 2018 <a href="http://www.52liming.com/">小鸣的微笔记</a></small>
    </footer>
</body>
</html>